/**
 * File Comment: and more GUIS
 */
package edu.gatech.oad.project.presentation;

//$codepro.audit.disable
import java.awt.Font;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.Insets;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JPanel;

/**
 * This class is a panel that allows the user
 * to interact with the GUI by providing a
 * home screen.
 * 
 * @author Group 17
 * @version 1
 */
public class DoctorHome extends JPanel {
  
  /**
   * Field driver: holds the Driver connected to the GUI
   */
  private Driver driver;
  
  /**
   * Field lblPatientHome: label
   */
  public JLabel lblDoctorHome;
  
  /**
   * Field btnViewedit: view/edit patients button
   */
  public JButton btnViewedit;
  
  /**
   * Field btnAppsByDoctor: view appointments by doctor button
   */
  public JButton btnAppsByDoctor;
  
  /**
   * Field btnAppsByDate: view appointments by date button
   */
  public JButton btnAppsByDate;
  
  /**
   * Field btnViewMonthlyIncome: view monthly income statement button
   */
  public JButton btnViewMonthlyIncome;
  
  /**
   * Field btnLogOut: log out button
   */
  public JButton btnLogOut;

 /**
  * Constructor.
  * 
  * @param driver the Driver connected to the GUI
  */
 public DoctorHome(Driver driver) {
   this.driver = driver;
  GridBagLayout gridBagLayout = new GridBagLayout();
  gridBagLayout.columnWidths = new int[]{0, 0, 0, 0, 0, 0};
  gridBagLayout.rowHeights = new int[]{0, 0, 0, 0, 0, 0, 0, 0, 0};
  gridBagLayout.columnWeights = new double[]{0.0, 0.0, 0.0, 0.0, 0.0, Double.MIN_VALUE};
  gridBagLayout.rowWeights = new double[]{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, Double.MIN_VALUE};
  setLayout(gridBagLayout);
  
  lblDoctorHome = new JLabel("Doctor Home");
  lblDoctorHome.setFont(new Font("Lucida Grande", Font.PLAIN, 30));
  GridBagConstraints gbc_lblDoctorHome = new GridBagConstraints();
  gbc_lblDoctorHome.insets = new Insets(0, 0, 5, 0);
  gbc_lblDoctorHome.gridx = 4;
  gbc_lblDoctorHome.gridy = 1;
  add(lblDoctorHome, gbc_lblDoctorHome);
  
  btnViewedit = new JButton("View/Edit Patients");
  btnViewedit.addActionListener(new ButtonListener1(this));
  GridBagConstraints gbc_btnViewedit = new GridBagConstraints();
  gbc_btnViewedit.insets = new Insets(0, 0, 5, 0);
  gbc_btnViewedit.gridx = 4;
  gbc_btnViewedit.gridy = 3;
  add(btnViewedit, gbc_btnViewedit);
  
  btnAppsByDoctor = new JButton("Appointments by Doctor");
  btnAppsByDoctor.addActionListener(new ButtonListener2(this));
  GridBagConstraints gbc_btnAppsByDoctor = new GridBagConstraints();
  gbc_btnAppsByDoctor.insets = new Insets(0, 0, 5, 0);
  gbc_btnAppsByDoctor.gridx = 4;
  gbc_btnAppsByDoctor.gridy = 4;
  add(btnAppsByDoctor, gbc_btnAppsByDoctor);
  
  btnAppsByDate = new JButton("Appointments for the Day\n");
  btnAppsByDate.addActionListener(new ButtonListener3(this));
  GridBagConstraints gbc_btnAppsByDate = new GridBagConstraints();
  gbc_btnAppsByDate.insets = new Insets(0, 0, 5, 0);
  gbc_btnAppsByDate.gridx = 4;
  gbc_btnAppsByDate.gridy = 5;
  add(btnAppsByDate, gbc_btnAppsByDate);
  
  btnViewMonthlyIncome = new JButton("View Monthly Income Statement");
  btnViewMonthlyIncome.addActionListener(new ButtonListener4(this));
  GridBagConstraints gbc_btnViewMonthlyIncome = new GridBagConstraints();
  gbc_btnViewMonthlyIncome.insets = new Insets(0, 0, 5, 0);
  gbc_btnViewMonthlyIncome.gridx = 4;
  gbc_btnViewMonthlyIncome.gridy = 6;
  add(btnViewMonthlyIncome, gbc_btnViewMonthlyIncome);
  
  btnLogOut = new JButton("Log Out");
  btnLogOut.addActionListener(new ButtonListener5(this));
  GridBagConstraints gbc_btnLogOut = new GridBagConstraints();
  gbc_btnLogOut.gridx = 4;
  gbc_btnLogOut.gridy = 7;
  add(btnLogOut, gbc_btnLogOut);
 } // end constructor method
 
 /**
  * Get the Driver.
  * 
  * @return the Driver connected to the GUI
  */
 public Driver getDriver()
 {
   return this.driver;
 } // end getDriver method

 /**
  * This private inner class implements ActionListener for btnViewedit.
  * 
  * @author Group 17
  * @version 1
  */
 private class ButtonListener1 implements ActionListener
 {
   /**
    * Field home: the home screen panel
    */
   private DoctorHome home;
   
   /**
    * Field driver: holds the driver connected to the GUI
    */
   private Driver driver;
   
   /**
    * Constructor.
    * 
    * @param home the home screen panel
    */
   private ButtonListener1(DoctorHome home)
   {
     this.home = home;
     this.driver = home.getDriver();
   } // end constructor method
   
   /**
    * Default method for ActionListener
    * 
    * @param e the ActionEvent triggering the ActionListener
    */
   public void actionPerformed(ActionEvent e)
   {
     this.driver.getFrame().setContentPane(new DoctorPatientList(this.driver));
     this.driver.getFrame().pack();
   } // end actionPerformed method
 } // end ButtonListener1 class
 
 /**
  * This private inner class implements ActionListener for btnAppsByDoctor.
  * 
  * @author Group 17
  * @version 1
  */
 private class ButtonListener2 implements ActionListener
 {
   /**
    * Field home: the home screen panel
    */
   private DoctorHome home;
   
   /**
    * Field driver: holds the Driver connected to the GUI
    */
   private Driver driver;
   
   /**
    * Constructor.
    * 
    * @param home the home screen panel
    */
   private ButtonListener2(DoctorHome home)
   {
     this.home = home;
     this.driver = home.getDriver();
   } // end constructor method
   
   /**
    * Default method for ActionListener.
    * 
    * @param e the ActionEvent triggering the ActionListener
    */
   public void actionPerformed(ActionEvent e)
   {
     this.driver.getFrame().setContentPane(new DoctorAppByDoctor(this.driver));
     this.driver.getFrame().pack();
   } // end actionPerformed method
 } // end ButtonListener2 class
 
 /**
  * This private inner class implements ActionListener for btnAppsByDate.
  * 
  * @author Group 17
  * @version 1
  */
 private class ButtonListener3 implements ActionListener
 {
   /**
    * Field home: the home screen panel
    */
   private DoctorHome home;
   
   /**
    * Field driver: holds the Driver connected to the GUI
    */
   private Driver driver;
   
   /**
    * Constructor.
    * 
    * @param home the home screen panel
    */
   private ButtonListener3(DoctorHome home)
   {
     this.home = home;
     this.driver = home.getDriver();
   } // end constructor method
   
   /**
    * Default method for ActionListener.
    * 
    * @param e the ActionEvent triggering the ActionListener
    */
   public void actionPerformed(ActionEvent e)
   {
     this.driver.getFrame().setContentPane(new DoctorAppByDate(this.driver));
     this.driver.getFrame().pack();
   } // end actionPerformed method
 } // end ButtonListener3 class
 
 /**
  * This private inner class implements ActionListener for btnViewMonthlyIncome.
  * 
  * @author Group 17
  * @version 1
  */
 private class ButtonListener4 implements ActionListener
 {
   /**
    * Field home: the home screen panel
    */
   private DoctorHome home;
   
   /**
    * Field driver: holds the Driver connected to the GUI
    */
   private Driver driver;
   
   /**
    * Constructor.
    * 
    * @param home the home screen panel
    */
   private ButtonListener4(DoctorHome home)
   {
     this.home = home;
     this.driver = home.getDriver();
   } // end constructor method
   
   /**
    * Default method for ActionListener.
    * 
    * @param e the ActionEvent triggering the ActionListener
    */
   public void actionPerformed(ActionEvent e)
   {
     this.driver.getFrame().setContentPane(new DoctorIncomeStatement(this.driver,this.driver.getSession().getUser()));
     this.driver.getFrame().pack();
   } // end actionPerformed method
 } // end  ButttonListener4 class
 
 /**
  * This private inner class implements ActionListener for btnLogOut.
  * 
  * @author Group 17
  * @version 1
  */
 private class ButtonListener5 implements ActionListener
 {
   /**
    * Field home: the home screen panel
    */
   private DoctorHome home;
   
   /**
    * Field driver: holds the Driver connected to the GUI
    */
   private Driver driver;
   
   /**
    * Constructor.
    * 
    * @param home the home screen panel
    */
   private ButtonListener5(DoctorHome home)
   {
     this.home = home;
     this.driver = home.getDriver();
   } // end constructor method
   
   /**
    * Default method for ActionListener.
    * 
    * @param e the ActionEvent triggering the ActionListener
    */
   public void actionPerformed(ActionEvent e)
   {
     this.driver.getFrame().setContentPane(new LogIn(this.driver));
     this.driver.getFrame().pack();
   } // end actionPerformed method
 } // end ButtonListener5 class
} // end DoctorHome class